﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace QuanLyChoVay
{
    public partial class frmMain : Form
    {
        public frmMain()
        {
            InitializeComponent();
        }


        #region Các hàm xử lý login và phân quyền
        private void DisableMenuLogin(bool logged )
        {
            itemDangNhap.Enabled = !logged;
            itemDangXuat.Enabled = logged;
            itemDoiMatKhau.Enabled = logged;
            itemQuanLy.Enabled = logged;
            itemTimKiem.Enabled = logged;            
        }


        #endregion
        private void đăngNhậpToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmLogin login = new frmLogin();
            login.Show();
           // this.Hide();
            DisableMenuLogin(true);
        }

        private void thoátToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void đổiMậtKhẩuToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmDoiMatKhau doimatkhau = new frmDoiMatKhau();
            doimatkhau.Show();
        }

        private void đăngXuấtToolStripMenuItem_Click(object sender, EventArgs e)
        {  
            frmLogin login = new frmLogin();
            login.Show();
            DisableMenuLogin(false);
        }

        private void frmMain_Load(object sender, EventArgs e)
        {
            DisableMenuLogin(false);
        }

        private void itemQuanLy_Click(object sender, EventArgs e)
        {
            frmQuanLyNguoiDung quanly = new frmQuanLyNguoiDung();
            quanly.Show();
        }

        private void thôngTinToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmThongTin Thongtin = new frmThongTin();
            Thongtin.Show();
        }
    }
}
